package ym.config;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import ym.service.IChatAssistant;
/**
 * 大模型配置
 */
@Configuration
public class LLMConfig {
    @Bean
    public ChatLanguageModel chatLanguageModel() {
        return OpenAiChatModel.builder()
                .apiKey("sk-aa74ecbcd54745ca88028dfa5f070033")
                .modelName("qwen-max")
                .logRequests(true)
                .logResponses(true)
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .build();
    }
    @Bean
    public IChatAssistant chatAssistant() {
        return AiServices.
                builder(IChatAssistant.class)
                .chatLanguageModel(chatLanguageModel())
                .build();
    }


}
